package com.qi.spzx.manager.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qi.spzx.model.entity.product.Category;
import com.qi.spzx.model.vo.product.CategoryExcelVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.poi.ss.formula.functions.T;

import java.util.List;

/**
 * @Description TODO
 * @Author dingchunlin
 * @Date 2024/2/22 18:13
 * @Version 1.0.0
 */
@Mapper
public interface CategoryMapper{

    @Select("select * from category where parent_id = #{parentId} and is_deleted = 1 order by id desc")
    List<Category> selectByParentId(Long parentId);


    @Select("select count(*) from category where parent_id = #{parentId} and is_deleted = 1")
    int countByParentId(Long id);

    @Select("select * from category where is_deleted = 1 order by id")
    List<Category> selectAll();

    void batchInsert(List<CategoryExcelVo> categoryList);

    @Select("select * from category where is_deleted = 1 and id = #{id}")
    Category selectById(Long id);
}
